package com.wangyuhang;

import com.wangyuhang.service.testService;
import com.wangyuhang.vo.User;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.util.List;

public class test {
    public static void main(String[] args) {
        ApplicationContext applicationContext=new AnnotationConfigApplicationContext(SpringConfig.class);
        testService service =  applicationContext.getBean(testService.class);
        List<User> allUsers = service.findAllUsers();
//        int id;
//        String name;
//        for (User user:allUsers){
//             id = user.getId();
//            name = user.getName();
//            System.out.println(id+","+name);
//
////            System.out.println(user);
//        }
        User user = service.findUser("lisi");
        System.out.println(user);


    }
}
